Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turf-nearest

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-nearest

turf nearest module

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

turf-nearest

Build Status

Returns the nearest point feature.

###Install

npm install turf-nearest

###Parameters

namedescription
inPointa Point Features
inFeaturesa FeatureCollection

###Usage

nearest(inPoint, inFeatures)

###Example

var nearest = require('turf-nearest')
var point = require('turf-point')
var featurecollection = require('turf-featurecollection')

var inPoint = point(-75.4, 39.4, {name: 'Location A'})
var pt1 = point(-75.343, 39.984, {name: 'Location B'})
var pt2 = point(-75.833, 39.284, {name: 'Location C'})
var pt3 = point(-75.534, 39.123, {name: 'Location D'})
var inFeatures = featurecollection([pt1, pt2, pt3])

var closestPoint = nearest(inPoint, inFeatures)

console.log(closestPoint)

Keywords

FAQs

Package last updated on 17 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc